<table width="100%">
    <tr>
        <th colspan="7">Piezas en  CTA</th>
    </tr>
    <tr>
        <th>Producto</th>
        <th>CTA</th>
        <th>Maquina</th>
        <th>Minutos</th>
        <th>Horas</th>
        <th>Turnos 8hrs</th>
        <th>Turnos 9hrs</th>
    </tr>
    {$cta=0}{$min=0}
    {foreach from=$tabla item=curr_tabla}
    {if $curr_tabla.cta > 0}
    {$m_req = ($curr_tabla.min*$curr_tabla.cta)}
    {if $m_req < 0}
    {$m_req =0}
    {/if}
    {$h_req = ($m_req/60)|round:1}
    {$t_re8 = ($h_req/8)|round:1}
    {$t_re9 = ($h_req/9)|round:1}
    <tr>
        <td title="Producto">{$curr_tabla.producto}</td>
        <td title="CTA">{$curr_tabla.cta}</td>
        <td title="Maquina">{$curr_tabla.maq}</td>
        <td title="Minutos">{$m_req}</td>
        <td title="Horas">{$h_req}</td>
        <td title="Turnos 8h">{$t_re8}</td>
        <td title="Turnos 9h">{$t_re9}</td>
    </tr>
    {$cta = $cta + $curr_tabla.cta}
    {$min = $min + $m_req}
    {/if}
    {/foreach}
    {$horas = ($min/60)|round:1}
    <tr>
        <th>TOTAL</th>
        <th>{$cta|number_format}</th>
        <th>&nbsp;</th>
        <th>{$min|number_format} minutos</th>
        <th>{$horas} horas</th>
        <th>{($horas/8)|round:1} turnos de 8h</th>
        <th>{($horas/9)|round:1} turnos de 9h</th>
    </tr>
</table>
<p>&nbsp;</p>
<table align="center" width="50%">
    <tr>
        <th>Maquina</th>
        <th>Minutos</th>
        <th>Horas</th>
        <th>Turnos 8H</th>
        <th>Turnos 9H</th>
    </tr>
{foreach from=$maquinas item=maq_tabla}
    <tr>
        <td>{$maq_tabla.maquina}</td>
        <td>{$maq_tabla.minutos}</td>
        <td>{($maq_tabla.minutos/60)|round:2}</td>
        <td>{(($maq_tabla.minutos/60)/8)|round:2}</td>
        <td>{(($maq_tabla.minutos/60)/9)|round:2}</td>
    </tr>
    {/foreach}
</table>